/*    */ package handling.Auction;
/*    */ 
/*    */ import configs.ServerConfig;
/*    */ import handling.ServerType;
/*    */ import handling.channel.PlayerStorage;
/*    */ import handling.netty.ServerConnection;
/*    */ import org.apache.logging.log4j.LogManager;
/*    */ import org.apache.logging.log4j.Logger;
/*    */ import server.MTSStorage;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AuctionServer
/*    */ {
/* 22 */   private static final Logger log = LogManager.getLogger(AuctionServer.class);
/*    */   private static ServerConnection init;
/*    */   private static String ip;
/*    */   private static PlayerStorage players;
/*    */   private static boolean finishedShutdown = false;
/*    */   private static short port;
/*    */   
/*    */   public static void run_startup_configurations() {
/*    */     try {
/* 31 */       port = ServerConfig.AUCTION_PORT;
/* 32 */       ip = ServerConfig.WORLD_INTERFACE;
/* 33 */       players = new PlayerStorage(-20);
/* 34 */       init = new ServerConnection(port, 0, -20, ServerType.拍卖服务器);
/* 35 */       init.run();
/* 36 */       log.info("拍卖服务器绑定端口: " + port + ".");
/* 37 */     } catch (Exception e) {
/* 38 */       throw new RuntimeException("拍卖服务器绑定端口 " + port + " 失败", e);
/*    */     } 
/*    */   }
/*    */   
/*    */   public static String getIP() {
/* 43 */     return ip;
/*    */   }
/*    */   
/*    */   public static short getPort() {
/* 47 */     return port;
/*    */   }
/*    */   
/*    */   public static PlayerStorage getPlayerStorage() {
/* 51 */     return players;
/*    */   }
/*    */   
/*    */   public static int getConnectedClients() {
/* 55 */     return getPlayerStorage().getConnectedClients();
/*    */   }
/*    */   
/*    */   public static void shutdown() {
/* 59 */     if (finishedShutdown) {
/*    */       return;
/*    */     }
/* 62 */     log.info("正在关闭拍卖服务器...");
/* 63 */     players.disconnectAll();
/* 64 */     MTSStorage.getInstance().saveBuyNow(true);
/* 65 */     log.info("拍卖服务器解除端口绑定...");
/* 66 */     init.close();
/* 67 */     finishedShutdown = true;
/*    */   }
/*    */   
/*    */   public static boolean isShutdown() {
/* 71 */     return finishedShutdown;
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\handling\Auction\AuctionServer.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */